function month_day(_month, _day) {
    var month = document.getElementById(_month);
    var day = document.getElementById(_day);
    function cmbSelect(cmb, str) {
        for (var i = 0; i < cmb.options.length; i++) {
            if (cmb.options[i].value == str) {
                cmb.selectedIndex = i;
                return cmb.selectedIndex + 1;
            }
        }
    }

    function createOptions(cmb, num) {
        // console.log(cmb, num);
        cmb.options.length = 0;
        for (var i = 0; i < num; i++) {
            var option = document.createElement("option");
            cmb.options.add(option);
            option.innerText = i + 1 + "日";
            option.value = parseInt(i) + 1;
            // console.log(option);
        }
        // console.log(cmb);
    }

    month.onchange = function () {
        // console.log(1);
        var val = cmbSelect(this, this.value);
        // console.log(val);
        if (val == 1) {
            createOptions(day, 31);
        } else if (val == 2) {
            createOptions(day, 29);
        } else if (val == 3) {
            createOptions(day, 31);
        } else if (val == 4) {
            createOptions(day, 30);
        } else if (val == 5) {
            createOptions(day, 31);
        } else if (val == 6) {
            createOptions(day, 30);
        } else if (val == 7) {
            createOptions(day, 31);
        } else if (val == 8) {
            createOptions(day, 31);
        } else if (val == 9) {
            createOptions(day, 30);
        } else if (val == 10) {
            createOptions(day, 31);
        } else if (val == 11) {
            createOptions(day, 30);
        } else if (val == 12) {
            createOptions(day, 31);
        }
    }

};
